package com.io;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;

import java.io.*;
import java.util.List;

public class IOUtilsTest {
    public static void main(String[] args) {
        InputStream is = null;
        OutputStream os = null;
        try {
            is = new FileInputStream("/Users/edy/Desktop/file1/1.txt");
            List<String> list1 = FileUtils.readLines(new File("/Users/edy/Desktop/file1/1.txt"), "UTF-8");
            for (String s : list1) {
                System.out.println(s);
            }
            List<String> list = IOUtils.readLines(is, "UTF-8");
            for (String s : list) {
                System.out.println(s);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            IOUtils.closeQuietly(is);
            IOUtils.closeQuietly(os);
        }


    }
}
